package chp2;

public class Vehicle {

	private int _currentSpeed;
	private double _currentDirection; //In degrees.
	private String _ownerName;
	private String _vehicleName;
	private long _idNum;
	private static long _nextID; 
	
	public Vehicle(){
		
	}
	
	public Vehicle(String vehicleName, String ownerName){
		this._vehicleName = vehicleName;
		this._idNum = _nextID++;
		this._ownerName = ownerName;
	}
	
	/**
	 * Prints the info of the current vehicle.
	 */
	public void printInfo() {
		System.out.println("Vehicle Name: " + _vehicleName);
		System.out.println("Current Speed = "+ _currentSpeed);
		System.out.println("Current Direction = " + _currentDirection);
		System.out.println("Owner Name = " + _ownerName);
		System.out.println("Id number = " + _idNum);
	}

	public void stop(){
		this._currentSpeed = 0;
	}
	/**
	 * @return the currentSpeed
	 */
	public int getCurrentSpeed() {
		return _currentSpeed;
	}

	/**
	 * @param currentSpeed the currentSpeed to set
	 */
	public void setCurrentSpeed(int currentSpeed) {
		this._currentSpeed = currentSpeed;
	}

	/**
	 * @return the currentDirection
	 */
	public double getCurrentDirection() {
		return _currentDirection;
	}

	/**
	 * @param currentDirection the currentDirection to set
	 */
	public void setCurrentDirection(double currentDirection) {
		this._currentDirection = currentDirection;
	}

	/**
	 * @return the ownerName
	 */
	public String getOwnerName() {
		return _ownerName;
	}

	/**
	 * @param ownerName the ownerName to set
	 */
	public void setOwnerName(String ownerName) {
		this._ownerName = ownerName;
	}

	/**
	 * @return the nextID
	 */
	public static long getNextID() {
		return _nextID;
	}

	/**
	 * @param nextID the nextID to set
	 */
	public static void setNextID(long nextID) {
		Vehicle._nextID = nextID;
	}

	public static void main(String[] args) {
		Vehicle builder = new Vehicle();
		Runner r = builder.new Runner();
		r.run();
	}

	public class Runner{
		private void run(){
			Vehicle vw = new Vehicle("VW", "Bob Loblaw");
			vw.printInfo();
			Vehicle honda = new Vehicle("Honda", "Eric Erickson");
			honda.printInfo();
			Vehicle saturn = new Vehicle("Saturn", "Me Meister");
			saturn.printInfo();
		}
	}

}
